#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include <QSqlTableModel>
#include <QComboBox>
#include "additem.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void showInfo();
    void showAdd();
    void setYearMonthBox();
    void musicPlay();
    void changePassword();
    void setUser(QString user);
    void deriveFile(int year,int month,int day);
    void deriveFile(int year,int month);
    void deriveFile(int year);
    void derive();
    void chartShow();
    void showCashBook();
    void mainCashBook();
    void changeTheme();
    void judgeBudget();
    void setLabel();
    void updateDatabase();
    double themeSumOut(int year,int month,QString theme);
    double themeSumOut(int year,QString theme);
    double eachDaySumOut(int year,int month,int day);
    double eachDaySumIn(int year,int month,int day);
    double eachMonthSumOut(int year,int month);
    double eachMonthSumIn(int year,int month);
    double eachYearSumOut(int year);
    QWidget* chartPieWidget(int year);
    QWidget* chartPieWidget(int year,int month);
    QWidget* chartBarWidget(int year);
    QWidget* chartBarWidget(int year,int month);
    QWidget* chartLineWidget(int year);
    QWidget* chartLineWidget(int year,int month);
private slots:
    void on_check_btn_clicked();
    void on_main_btn_clicked();
    void on_chart_btn_clicked();
    void on_limit_btn_clicked();
    void on_info_btn_clicked();
    void on_add_btn_clicked();
    void radioButtonFun_4();
    void on_derive_btn_clicked();    
    void on_info_clicked();
    void on_update_btn_clicked();
    void on_theme_btn_clicked();
    void on_delete_btn_clicked();
    void on_clear_btn_clicked();
    void on_music_btn_clicked();
    void on_pie_btn_released();
    void on_line_btn_released();
    void on_bar_btn_released();
    void on_calendarWidget_clicked(const QDate &date);
    void on_editTableView_clicked(const QModelIndex &index);
    void on_dayBudgetSetButton_clicked();
    void on_monthBudgetSetButton_clicked();
    void on_yearBudgetSetButton_clicked();
    void on_save_btn_clicked();
    void on_editTableView_doubleClicked(const QModelIndex &index);
    void on_exit_btn_clicked();
    void on_pushButton_clicked();

private:
    Ui::MainWindow *ui;
    QString username;
    QSqlTableModel *model;
    addItem *addWindow;
    int id;
};
#endif // MAINWINDOW_H
